//
//  YKRegistViewController.m
//  yuke
//
//  Created by Dejun Liu on 15/1/12.
//  Copyright (c) 2015年 juwan. All rights reserved.
//

#import "YKRegistViewController.h"
#import "YKRegistTextField.h"

@interface YKRegistViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet YKRegistTextField *emailTextField;
@property (weak, nonatomic) IBOutlet YKRegistTextField *userNameTextField;
@property (weak, nonatomic) IBOutlet YKRegistTextField *passwordTextField;

@end

@implementation YKRegistViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textfieldValueChange:) name:UITextFieldTextDidChangeNotification object:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)textfieldValueChange:(NSNotification *)notify
{
    YKRegistTextField *tf = notify.object;
    if (tf == self.emailTextField) {
        if ([self.emailTextField.text isValidEmailAddress]) {
            self.emailTextField.textColor = [UIColor blackColor];
        }else
        {
            self.emailTextField.textColor = [UIColor redColor];
        }
    }else if(tf == self.userNameTextField)
    {
        
    }else if(tf == self.passwordTextField)
    {
        
    }
}

- (IBAction)regesitClick:(id)sender {
    
}

@end
